from db.dbUtils import MysqlPool


def get_students_by_class_id(class_id):
    with MysqlPool() as pool:
        c = pool.cursor
        c.execute(
            """SELECT * FROM `se_user` WHERE `u_c_id`={}""".format(class_id)
        )
        return c.fetchall()


def get_student_by_user_id(user_id):
    with MysqlPool() as pool:
        c = pool.cursor
        c.execute(
            """SELECT * FROM `se_user` WHERE `u_id`={}""".format(user_id)
        )
        return c.fetchall()[0]